import REDIS_DB_NAME from '@/config/RedisDbName'

// src/config/Config.ts
const isDev = process.env.NODE_ENV === 'development'

export default class Config {
  // 服务器端口
  public static readonly HTTP_PORT = 9000
  // socket服务器端口
  public static readonly WS_PORT = 9001
  // 接口前缀
  public static readonly API_PREFIX = '/api/'
  // 根目录
  public static readonly BASE = isDev ? 'src' : 'dist/src'

  // 默认时间格式
  public static readonly DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss'

  // redis数据库
  public static readonly REDIS_DB_NAME = REDIS_DB_NAME

  //是否为测试环境
  public static IS_DEV = isDev

  public static EMAIL_SENDER_NAME = '1689918337@qq.com'

  public static EMAIL_SERVICE = 'QQ'

  public static EMAIL_SENDER_PASS = 'utlzvsdqtjdtegha'

  public static EMAIL_PORT = 465

  // LTAI5tJ9j2k9cGbVh3cFQ4PM
  // D8k3zIeVzYaJ7iUfBtdwGQ8dPppc07

  public static MOBILE_ACCESS_KEY = 'LTAI5tJ9j2k9cGbVh3cFQ4PM'

  public static MOBILE_ACCESS_KEY_SECRETE = 'D8k3zIeVzYaJ7iUfBtdwGQ8dPppc07'

  public static MOBILE_ENDPOINT = `dysmsapi.aliyuncs.com`

  public static MOBILE_SIGN_NAME = `F云盘短信发送`

  public static MOBILE_TEMPLATE_CODE = `SMS_468920124`

  // 安全配置
  public static readonly SECURITY = {
    // token key
    SECRET_KEY: 'learn-koa-ts',
    // 过期时间
    EXPIRES_IN: 60 * 60 * 24 * 0.5, // token 过期时间 12 小时
    // 存储token的redis数据库名
    TOKEN_REDIS_DB: Config.REDIS_DB_NAME.TOKEN,
    // 存储smscode的redis数据库名
    SMSCODE_REDIS_DB: Config.REDIS_DB_NAME.SMSCODE,
    SMSCODE_INTERVAL_DB: Config.REDIS_DB_NAME.SMSCODE_INTERVAL,
    // 过期时间
    SMSCODE_EXPIRES_IN: 5, // 5分钟
  }

  // mysql配置
  public static readonly MYSQL = {
    DB_NAME: 'mydb',
    HOST: '127.0.0.1',
    PORT: 3306,
    USER_NAME: 'root',
    PASSWORD: '8ik,(OL>',
    CONNECTION_LIMIT: 60 * 60 * 1000,
    CONNECT_TIMEOUT: 1000 * 60 * 60 * 1000,
    ACQUIRE_TIMEOUT: 60 * 60 * 1000,
    TIMEOUT: 1000 * 60 * 60 * 1000,
  }
  // // redis
  public static readonly REDIS = {
    PORT: 6379,
    HOST: '127.0.0.1',
    PASSWORD: 'admin',
    DB: 0,
  }
  // 七牛云配置
  public static readonly QINIU = {
    AK: '_2Dr1lAr6M1rVD2YbifWnzZFvM4NFg21gFzkloy_',
    SK: 'cmWMIVc7xy98E1L7hg22XEZUt4EQqa2duii6OnxC',
    BUCKET: 'node-static-test', // 七牛云存储空间名
  }

  public static readonly COS_CONFIG = {
    SecretId: 'AKIDqY4OVVWQ8jIl4B5oNn272kIdpumTzKRL',
    SecretKey: 'mHbt2yjSyGOJ2byHPLPHyVpywuhMq8F9',
    Bucket: 'fuybooo-1375083581',
    Region: 'ap-guangzhou',
  }
}
